package com.hzlj.position.locate.converter;

import com.fz.common.base.converter.ModelDTOConverter;
import com.fz.common.base.core.date.DateUtils;
import com.hzlj.position.locate.common.dto.abnProhibitAreasPosition.AbnProhibitAreasPositionAddDTO;
import com.hzlj.position.locate.common.dto.abnProhibitAreasPosition.AbnProhibitAreasPositionQueryResultDTO;
import com.hzlj.position.locate.common.model.AbnProhibitAreasPosition;

/**
 * 禁止区域-定位记录(AbnProhibitAreasPosition)DTO转换类
 *
 * @author lifh
 * @date 2023-03-28 10:20:36
 */
public class AbnProhibitAreasPositionConverter {
    /**
     * model实例转换为查询结果DTO
     *
     * @param model model实例
     * @return DTO
     */
    public static AbnProhibitAreasPositionQueryResultDTO from(AbnProhibitAreasPosition model) {
        return ModelDTOConverter.from(model, AbnProhibitAreasPositionQueryResultDTO.class);
    }

    /**
     * 新增DTO转换为model实例
     *
     * @param dto 新增DTO
     * @return model实例
     */
    public static AbnProhibitAreasPosition from(AbnProhibitAreasPositionAddDTO dto) {
        return ModelDTOConverter.from(dto, AbnProhibitAreasPosition.class, (AbnProhibitAreasPosition l) -> {
            l.setValid(true);
            l.setUpdateTime(DateUtils.now());
            l.setCreateTime(DateUtils.now());
        });

    }

}
